package com.zw.yzk.kabu.mapper;

import com.zw.yzk.kabu.data.network.entity.LogisticsEntity;
import com.zw.yzk.kabu.model.LogisticsModel;

import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;

/**
 * Created by zhanwei on 2017/3/18.
 */

public class LogisticsMapper {

    @Inject
    public LogisticsMapper() {
    }

    public LogisticsModel transfer(LogisticsEntity.Logistics logistics) {
        LogisticsModel model = new LogisticsModel();
        model.setTime(logistics.time);
        model.setLogisticsInfo(logistics.acceptStation);

        return model;
    }

    public List<LogisticsModel> transfer(List<LogisticsEntity.Logistics> list) {
        List<LogisticsModel> modelList = new ArrayList<>();
        if(list == null || list.isEmpty()) {
            return modelList;
        }
        for(LogisticsEntity.Logistics logistics : list) {
            modelList.add(transfer(logistics));
        }
        return modelList;
    }
}
